home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / codelib7 / v_09_06 / 9n06076a < prev    next >
Encoding:
Text File  |  1995-11-01  |  455 b   |  19 lines

  1.  
  2. Listing 1:  Traditional getopt(3) Command Line Processing
  3. =========================================================
  4.  
  5. while ((option = getopt (argc, argv, optstring)) != -1) {
  6.     switch (option) {
  7.     case 'a': ... ;  break ;    /* Options */
  8.     case 'b': ... ;  break ;
  9.     ...
  10.     case '?': ... error ...
  11.     default:  break ;
  12.     }
  13. }
  14. while (optind < argc) {         /* Non-option arguments */
  15.     ... process argv[optind++] ...
  16. }
  17.  
  18.  
  19.